From 54c67437872d943d425f22ab33621feae7d2fd3c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 26 Nov 2004 05:43:38 +0000 Subject: [PATCH] =?utf8?q?Don't=20crash=20if=20Xlib=20fails=20to=20return?= =?utf8?q?=20UTF-8.=20(#159373,=20Kristian=20H=C3=B8gsberg)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2004-11-26 Matthias Clasen * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gdk/x11/gdkselection-x11.c | 10 ++++++++-- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95e7005615..af9a19f041 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-11-26 Matthias Clasen + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): + Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg) + Thu Nov 25 14:32:35 2004 Manish Singh * gdk/abicheck.sh diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 95e7005615..af9a19f041 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2004-11-26 Matthias Clasen + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): + Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg) + Thu Nov 25 14:32:35 2004 Manish Singh * gdk/abicheck.sh diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 95e7005615..af9a19f041 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2004-11-26 Matthias Clasen + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): + Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg) + Thu Nov 25 14:32:35 2004 Manish Singh * gdk/abicheck.sh diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 95e7005615..af9a19f041 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2004-11-26 Matthias Clasen + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): + Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg) + Thu Nov 25 14:32:35 2004 Manish Singh * gdk/abicheck.sh diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 13aca15cea..06374c5cf6 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -643,14 +643,20 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, else { if (list) - (*list)[count++] = g_strdup (local_list[i]); + { + if (g_utf8_validate (local_list[i], -1, NULL)) + (*list)[count++] = g_strdup (local_list[i]); + else + g_warning ("Error converting selection"); + } } } if (local_count) gdk_free_text_list (local_list); - (*list)[count] = NULL; + if (list) + (*list)[count] = NULL; return count; } -- 2.30.2